
pkgname=libpcap
pkgver=1.8.1
pkgrel=1
pkgdesc="A system-independent interface for user-level packet capture"
arch=('x86_64')
url="http://www.tcpdump.org/"
license=('BSD')
depends=('glibc' 'libnl' 'sh' 'libusb')
makedepends=('flex' 'bluez') # 'linux-headers')
source=("https://github.com/the-tcpdump-group/libpcap/archive/libpcap-${pkgver}.tar.gz")
md5sums=('4a70f59c943b21340deca4affe63ea4c')

build() {
  cd ${pkgname}-${pkgname}-${pkgver}
  
  ./configure --prefix=/usr --enable-ipv6 
  make
}

package() {
  cd ${pkgname}-${pkgname}-${pkgver}
  install -d -m755 ${pkgdir}/usr/bin
  make DESTDIR=${pkgdir} install
  
  install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
  
  rm -rf ${pkgdir}/usr/lib/libpcap.a
  
  # backwards compatibility, programs often look for net/bpf.h
  mkdir -p ${pkgdir}/usr/include/net
  cd ${pkgdir}/usr/include/net
  ln -s ../pcap-bpf.h bpf.h
}

